Skip to content

schemas: allow null as a valid FilterTopic entry#835

Open
m1lestones wants to merge 2 commits into
ethereum:mainfrom
m1lestones:fix/filter-topic-null
Open

schemas: allow null as a valid FilterTopic entry#835
m1lestones wants to merge 2 commits into
ethereum:mainfrom
m1lestones:fix/filter-topic-null

Conversation

@m1lestones

Copy link
Copy Markdown

Summary

Fixes the remaining open issue in #118.

A null entry at a topic position in a filter means "match any topic at this position" — this is valid per the Ethereum JSON-RPC spec and widely used in practice. For example:

{
  "topics": ["0xABC...", null, ["0xDEF...", "0x123..."]]
}

Position 0: match specific topic, position 1: match anything, position 2: match either of two topics.

However, FilterTopic only allowed bytes32 or an array of bytes32null was not a valid entry, causing schema validators to reject otherwise valid filters.

Change

Added null as a valid oneOf option in the FilterTopic schema in src/schemas/filter.yaml.

Test plan

  • make build && make test — all passing

Closes #118

A null at a topic position in a filter means "match any topic at this
position", which is valid per the Ethereum JSON-RPC spec. The FilterTopic
schema only allowed bytes32 or an array of bytes32, causing validators to
reject filters like:

  {"topics": ["0xABC...", null, ["0xDEF...", "0x123..."]]}

Closes ethereum#118
@fjl

fjl commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

I approved, but would be nice to add a test.

@m1lestones

Copy link
Copy Markdown
Author

Added a test case in tests/eth_getLogs/topic-null-wildcard.io that validates a filter with null in topic position zero acting as a wildcard. All passing with make build && make test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incorrect spec for Filter

2 participants